﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:Controls="clr-namespace:Informant.UI.Wpf.Controls"
             x:Class="Informant.UI.Wpf.Controls.WaitCursor"
             mc:Ignorable="d"
             d:DesignWidth="326"
             d:DesignHeight="326">
    <UserControl.Resources>
        <Storyboard x:Key="RotationStoryboard"
                    RepeatBehavior="Forever">
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
                                           Storyboard.TargetName="OutterCircle"
                                           Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)">
            	<SplineDoubleKeyFrame KeyTime="00:00:01"
            		Value="360" />
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>
    <UserControl.Triggers>
        <EventTrigger RoutedEvent="Controls:WaitCursor.Activated">
            <BeginStoryboard Name="BeginRotationStoryboard" Storyboard="{StaticResource RotationStoryboard}" />
        </EventTrigger>
        <EventTrigger RoutedEvent="Controls:WaitCursor.Deactivated">
        	<StopStoryboard BeginStoryboardName="BeginRotationStoryboard"/>
        </EventTrigger>
    </UserControl.Triggers>
    <Grid>
        <Path x:Name="OutterCircle"
              Stretch="Fill"
              Stroke="#7F000000"
              Data="M150,53 C96.428383,53 53,96.428383 53,150 53,203.57162 96.428383,247 150,247 203.57162,247 247,203.57162 247,150 247,96.428383 203.57162,53 150,53 z M150,0.5 C232.56657,0.5 299.5,67.433434 299.5,150 299.5,232.56657 232.56657,299.5 150,299.5 67.433434,299.5 0.5,232.56657 0.5,150 0.5,67.433434 67.433434,0.5 150,0.5 z"
              StrokeThickness="0.5"
              RenderTransformOrigin="0.5,0.5">
            <Path.RenderTransform>
                <TransformGroup>
                    <ScaleTransform />
                    <SkewTransform />
                    <RotateTransform />
                    <TranslateTransform />
                </TransformGroup>
            </Path.RenderTransform>
            <Path.Fill>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="#BF080808"
                                  Offset="0" />
                    <GradientStop Color="#3FFFFFF6"
                                  Offset="1" />
                </LinearGradientBrush>
            </Path.Fill>
        </Path>
    </Grid>
</UserControl>
